package com.tianpengtech.admin.opertion;
import com.jfinal.aop.Before;
import com.jfinal.plugin.activerecord.Model;
import com.tianpengtech.admin.AbstractAdminController;
import com.tianpengtech.admin.IAdminLogRecord;
import com.tianpengtech.admin.InitInterceptor;
import com.tianpengtech.common.exception.ValidateException;
import com.tianpengtech.common.model.authenticate.Authenticate;
import com.tianpengtech.common.model.opertion.Opertion;

/**
* 路由配置地址：add("/admin/opertion", OpertionAdminController.class, "/admin/opertion");
* 数据库映射地址：arp.addMapping(Opertion.dao.tableName(),Opertion.class);
*/
@Before(InitInterceptor.class)
public class OpertionAdminController extends AbstractAdminController{
	private IAdminLogRecord record = new OpertionAdminServiceImpl();
	
	@Override
	protected void config() {
		this.clazz=Opertion.class;
		this.service=new OpertionAdminServiceImpl();
	}

	@Override
	public void beforeAdd() {

	}

	@Override
	public void beforeAdd(Model< ? > model) throws ValidateException {

	}

	@Override
	public void beforeQueryById(Model<?> model, int id) {

	}

	@Override
	public void beforeUpdate(Model< ? > model) throws ValidateException {

	}

	@Override
	public void beforeDelete(Model< ? > model) {

	}

	public void queryLog(){
		int obj_id = getParaToInt("id");
		int taskType = getParaToInt("taskType",0);
		setAttr("logs", record.queryOperationsByObjId(obj_id,taskType));
		renderTemplate("opertion-log-list.html");
	}

	@Override
	public void parsePageRecord(Object results) {
		// TODO Auto-generated method stub
		
	}
}

	